package com.Multi_threaded;

import java.util.concurrent.atomic.AtomicInteger;

public class LeGuanLock {
    public static void main(String[] args) {
         test test=new test();
        for (int i = 0; i < 100; i++) {
            new Thread(test).start();
        }
    }

}

/**
 * 乐观锁
 */
class test implements Runnable{
    AtomicInteger count=new AtomicInteger();
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(Thread.currentThread().getName()+"=================>"+count.incrementAndGet());
        }
    }
}
